package com.auicyh.tylb.model;


import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;

/**
 * 作者：  Ocean 2017/9/7 10:52
 * 功能：  图文数据模型
 * Q Q：   1126067113
 * 修改：
 * @author Ocean
 */

public class ImageTextModel implements Parcelable {
    /** 图片名资源Id */
    private int mImageRes;
    /** 文字 */
    private int mNameRes;
    /** 文字 */
    private String mTxt;
    /** 颜色 */
    private int mColorRes;
    /** 资源名字 */
    private String mResName;

    public ImageTextModel() {
    }


    public ImageTextModel(int nameRes, String txt, int colorRes) {
        mNameRes = nameRes;
        mTxt = txt;
        mColorRes = colorRes;
    }

    /**
     * @param txt     txt
     * @param resName resName
     */
    public ImageTextModel(String txt, String resName) {
        mTxt = txt;
        mResName = resName;
    }

    /**
     * @param nameRes  名字
     * @param imageRes 图片资源ID
     */
    public ImageTextModel(@StringRes int nameRes, @DrawableRes int imageRes) {
        mImageRes = imageRes;
        mNameRes = nameRes;
    }


    protected ImageTextModel(Parcel in) {
        mImageRes = in.readInt();
        mNameRes = in.readInt();
        mTxt = in.readString();
        mColorRes = in.readInt();
        mResName = in.readString();
    }

    public static final Creator<ImageTextModel> CREATOR = new Creator<ImageTextModel>() {
        @Override
        public ImageTextModel createFromParcel(Parcel in) {
            return new ImageTextModel(in);
        }

        @Override
        public ImageTextModel[] newArray(int size) {
            return new ImageTextModel[size];
        }
    };

    public int getImageRes() {
        return mImageRes;
    }

    public void setImageRes(int imageRes) {
        mImageRes = imageRes;
    }

    public int getNameRes() {
        return mNameRes;
    }

    public void setNameRes(int nameRes) {
        mNameRes = nameRes;
    }

    public String getTxt() {
        return mTxt;
    }

    public void setTxt(String txt) {
        mTxt = txt;
    }

    public int getColorRes() {
        return mColorRes;
    }

    public void setColorRes(int colorRes) {
        mColorRes = colorRes;
    }

    public String getResName() {
        return mResName;
    }

    public void setResName(String resName) {
        mResName = resName;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mImageRes);
        dest.writeInt(mNameRes);
        dest.writeString(mTxt);
        dest.writeInt(mColorRes);
        dest.writeString(mResName);
    }
}
